package util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class ConnectionFactory {
	public static Connection getConnection() {
		Connection connection = null;
		try {
			Class.forName(Constants.DB_DRIVER);
		} catch (ClassNotFoundException e) {
			System.out.println("MySQL JDBC Driver not found!");
			e.printStackTrace();
			return connection;
		}
		try {
			connection = DriverManager.getConnection(Constants.DB_CONNECTION,
					Constants.DB_USER, Constants.DB_PASSWORD);
		} catch (SQLException e) {
			System.out.println("Connection Failed! Check output console.");
			e.printStackTrace();
			return connection;
		}
		return connection;
	}	
}